-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[VIP-Travel] Workspace address page and section in workspace profile #38381
[VIP-Travel] Workspace address page and section in workspace profile #38381
Conversation
const {translate} = useLocalize(); | ||
const address = useMemo(() => policy?.address, [policy]); | ||
const [currentCountry, setCurrentCountry] = useState(address?.country); | ||
const [street1, street2] = (address?.addressStreet ?? '').split('\n'); | ||
const [state, setState] = useState(address?.state); | ||
const [city, setCity] = useState(address?.city); | ||
const [zipcode, setZipcode] = useState(address?.zip); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move it to form, please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AddressForm is already a FormProvider. Those useState hooks are needed for implementation of handleAddressChange
. I agree we could simplify this as the performance is quite similar to what happens in AddressPage. But it requires some refactoring to AddressPage and AddressForm and I think it should be handled in a different PR. Especially since this PR's issue is critical.
if (addressKey !== 'country' && addressKey !== 'state' && addressKey !== 'city' && addressKey !== 'zip') { | ||
return; | ||
} | ||
if (addressKey === 'country') { | ||
setCurrentCountry(countryValue); | ||
setState(''); | ||
setCity(''); | ||
setZipcode(''); | ||
return; | ||
} | ||
if (addressKey === 'state') { | ||
setState(countryValue); | ||
setCity(''); | ||
setZipcode(''); | ||
return; | ||
} | ||
if (addressKey === 'city') { | ||
setCity(countryValue); | ||
setZipcode(''); | ||
return; | ||
} | ||
setZipcode(countryValue); | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will get simplified afterwards I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as here.
city={city} | ||
country={currentCountry} | ||
onAddressChanged={handleAddressChange} | ||
state={state} | ||
street1={street1} | ||
street2={street2} | ||
zip={zipcode} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
afterwards, you can pass form data as a whole, or include it inside of AddressForm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as here.
src/libs/actions/Policy.ts
Outdated
policyID, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'data[addressStreet]': newAddress.addressStreet, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'data[city]': newAddress.city, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'data[country]': newAddress.country, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'data[state]': newAddress.state, | ||
// eslint-disable-next-line @typescript-eslint/naming-convention | ||
'data[zipCode]': newAddress.zip, | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this definitely needs to be discussed, it's weird we're passing it this way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
100% agreed. I think this is something what needs backend changes. I tried many different ways to make this API request and this is the only one which works.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The thread about changing the endpoint on backend: https://swmansion.slack.com/archives/C05S5EV2JTX/p1713825690019579
In case of changes we need to modify this part.
@shubham1206agra Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Just noting I created a polish issue above. Doesn't need to be included with this PR. |
Screen.Recording.2024-04-29.at.9.26.27.PM.mov@smelaa Please observe the logs when I click on the address from auto complete. It is trying to navigate too many times. |
Reviewer Checklist
Screenshots/VideosAndroid: NativeAndroid: mWeb ChromeScreen.Recording.2024-04-29.at.9.55.58.PM.moviOS: NativeScreen.Recording.2024-04-29.at.10.12.44.PM.moviOS: mWeb SafariScreen.Recording.2024-04-29.at.9.43.37.PM.movMacOS: Chrome / SafariScreen.Recording.2024-04-29.at.9.30.00.PM.movMacOS: DesktopScreen.Recording.2024-04-29.at.10.01.45.PM.mov |
We did not find an internal engineer to review this PR, trying to assign a random engineer to #37827 as well as to this PR... Please reach out for help on Slack if no one gets assigned! |
@twisterdotcom There seems to be some BE issue where addresses are not retaining for multiple workspaces. |
@@ -0,0 +1,12 @@ | |||
// TODO: Change API endpoint parameters format to make it possible to follow naming-convention |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Has an issue been created for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deetergp is working on it here: https://github.com/Expensify/Web-Expensify/pull/41840
@shubham1206agra I've investigated this issue, and it also happens in |
Nice, @shubham1206agra could you report the bug in #expensify-bugs for that, and we'll get it cleaned up after? |
Anything stopping us from merging now? |
Nothing. |
Ahh, actually don't need you here @rushatgabhane. |
#41505 |
🚀 Deployed to production by https://github.com/marcaaron in version: 1.4.70-5 🚀
|
Agreed. @smelaa can you please take a look at that bug? |
Sure, the draft PR is almost done. |
Details
This PR adds workspace address page and address section in workspace profile. Currently it only saves the data in the state. Once backend is ready it should be adjusted to save the data using API.
Fixed Issues
$#37827
PROPOSAL:
Tests
Permissions.canUseSpotnanaTravel
function returning always true.Offline tests
N/A
QA Steps
Same as tests.
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop